package Main
{
	import flash.net.FileFilter;

	public class Util
	{
		private static var atlFiles:FileFilter = new FileFilter("ATL file", "*.atl");
		private static var metamodelFiles:FileFilter = new FileFilter("Metamodel files", "*.ecore;*.xmi");
		private static var xmiFiles:FileFilter = new FileFilter("XMI file", "*.xmi");
		private static var atlArray:Array = new Array(atlFiles);
		private static var metamodelArray:Array = new Array(metamodelFiles);
		private static var xmiArray:Array = new Array(xmiFiles);
		
		public static var CONTENT_IMAGE_PATH:String = "./Img/codeIconSmall.gif";
		public static var OVER_CONTENT_IMAGE_PATH:String = "./Img/codeIconSmallOver.gif";
		public static var CLICKED_CONTENT_IMAGE_PATH:String = "./Img/codeIconSmallClick.gif";
		
		public static var TRNSF_NAME:String = "ATL Transformation";
		public static var SRC_MODEL_NAME:String = "Source Model";
		public static var ERR_CODE_MISSING_SRC_MM:int = 10;
		public static var ERR_CODE_MISSING_TRGT_MM:int = 10;
		public static var ERR_CODE_MISSING_MM:String = "Error: 5";
		public static var ERR_CODE_ATL_SYNTAX:String = "Error: 3";
		public static var ERR_CODE_EXISTING_FILE:String = "Error: 2";
		public static var ERR_CODE_INCOMPATIBLE_ARTIFACTS:String = "Error: 11";
		public static var OK_CODE_ATL:int = 10;
		/**
		 * Code for the target's name. '#1'
		 * */
		public static var NAME:String = "#1";
		/**
		 * Code for the target's content. '#2'
		 * */
		public static var CONTENT:String = "#2";
		/**
		 * Code for the target's creation date. '#3'
		 * */
		public static var CREATION_DATE:String = "#3";
		/**
		 * Code for the source metamodel name from target transformation. '#4'
		 * */
		public static var ATL_SOURCE_METAMODEL:String = "#4";
		/**
		 * Code for the source model name from target transformation. '#5'
		 * */
		public static var ATL_SOURCE_MODEL:String = "#5";
		/**
		 * Code for the target metamodel name from target transformation. '#6'
		 * */
		public static var ATL_TARGET_METAMODEL:String = "#6";
		/**
		 * Code for the target model name from target transformation. '#7'
		 * */
		public static var ATL_TARGET_MODEL:String = "#7";
		/**
		 * Code for target transformation rules. '#8'
		 * */
		public static var ATL_RULES:String = "#8";
		
		
		/**
		 * Formats a string representation of a floating point number so it only shows 2 decimal numbers after the '.'
		 * */
		public static function formatNumber(s:String):String {
			var pointIndex:int = s.indexOf(".");
			var ret:String = "";
			if (s.length < pointIndex + 2) {
				ret = s + "0";
			} else {
				ret = s.substr(0, pointIndex+3);
			}
			return ret;
		}
		
		public static function getAtlArray():Array {
			return atlArray;
		}
		
		public static function getMetamodelArray():Array {
			return metamodelArray;
		}
		
		public static function getXmiArray():Array {
			return xmiArray;
		}
	}
}